package com.firexxx.study.threadpool;

import lombok.AllArgsConstructor;

import java.util.concurrent.BlockingQueue;

/**
 * @description: TODO
 * @author: zhuangzhang2
 * @date: 2020-11-05 09:42
 */
@AllArgsConstructor
public class Consumer implements Runnable {

    private BlockingQueue<ITask> queue;

    @Override
    public void run() {
        while (true) {
            try {
                Thread.sleep(1000);

                ITask iTask = queue.take();
                iTask.run();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

}
